package org.timemachine.action.dao;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class EntityDao {

	public EntityDao() {
	}

	@PersistenceContext
	private EntityManager em;

	public Object find(Class<?> c, Object id) {
		return em.find(c, id);
	}

	@SuppressWarnings("unchecked")
	public List<Object> list(String query) {
		return em.createQuery(query).getResultList();
	}
	
	public void persist(Object t) {
		em.persist(t);
	}

	public Object merge(Object t) {
		return em.merge(t);
	}

}
